#ifndef Lily_broadcast
#define Lily_broadcast
#ifdef __cplusplus
extern "C"
{
#endif

	typedef void (*LiEventListener)(void *private_data, void *event_data);

	typedef struct
	{
		union
		{
			_NameTuple_t nameTuple;
			struct
			{
				char *name;
				HASH hashCode;
			};
		};
		Li_List receivers;
	} Broadcast_t;
	typedef Broadcast_t *Broadcast;

	typedef struct
	{
		void *private_data;
		LiEventListener f;
	} _LiReceiver_t;
	typedef _LiReceiver_t *_LiReceiver;

	Broadcast li_new_event(const char *id);
	Broadcast li_get_event(const char *id);
	void li_remove_event(const char *id);

	void event_broadcast_from(Broadcast b, void *event_data);
	void event_broadcast_from_tag(const char *name, void *event_data);
	
	int event_register_to(Broadcast b, void *private_data, LiEventListener f);
	int event_register_to_tag(const char *name, void *private_data, LiEventListener f);
	
	void event_deregister_from(Broadcast b, void *private_data, LiEventListener f);
#ifdef __cplusplus
}
#endif

#endif
